home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / editpat.lha / DisplayPat.Text (.txt) < prev    next >
Encoding:
Oberon Text  |  1994-11-15  |  7.7 KB  |  80 lines

  1. Syntax10.Scn.Fnt
  2. ParcElems
  3. Alloc
  4. Syntax16b.Scn.Fnt
  5. Syntax16.Scn.Fnt
  6. Syntax14.Scn.Fnt
  7. Syntax8.Scn.Fnt
  8. StyleElems
  9. Alloc
  10. Absatz
  11. Syntax12b.Scn.Fnt
  12. Syntax10b.Scn.Fnt
  13. Absatz
  14. Absatz
  15. Absatz
  16. Absatz
  17. Absatz
  18. Absatz
  19. Absatz
  20. Absatz
  21. Absatz
  22. Absatz
  23. Absatz
  24. Absatz
  25. Absatz
  26. Absatz
  27. DisplayPat V0.7
  28.                      
  29. Ralf  Degner
  30.  (C)  04.11.1994
  31. A Dispay Module for EditPat Files
  32. Copyright:
  33. EditPat and all files in this distribution are (C)opyright 1994 by Ralf Degner
  34. The Oberon System is (C)opyright 1990-1994 by Institut f
  35. r Computersysteme, ETH Z
  36. rich.
  37. Disclaimer:
  38. The author takes no responsibility for any result of the use of this progrm. You use it by your own risk.
  39. How To Use:
  40. First you have to design a pattern file (use Pat as suffix) with EditPat. Remember the number of every pattern. Now You can use DisplayPat to display the patterns on the screen. What to do using DisplayPat in Your program:
  41.     First You have to IMPORT the module DisplayPat. The pattern data is linked to an object, called DisplayPat.Object. Define a variable of this type, let`s call it O. The Object is only a POINTER, so you have to create the real object data with NEW(O). Now You have a full Object, but there is no data linked to it. Use the method Install ( O.Install ) to fill the Object with the pattern data from a file. Now You are able to display Your patterns. The display methods have the same names, as you know them from the procedures in the module Display. But here, You do not specify the pattern by a Display.Pattern, here You use the number of the pattern in the file. You are able to open more than one object with data from different files.
  42.     In most methods from DisplayPat you can define a color (col). If you want to see the original colors, use DisplayPat.OriCol as col. An other color will display all pixels of the pattern in this color (multicolor goes away). It is possible, that the original of the patterns do not fit to your special system. There are two ways to handle this. First, You can modify the colors of your system (with Colors.Open ). The second is to force the Object to display not the original colors. An example will show this: in a patternfile color number 4 stands for yellow, but at your system, yellow has number 10. With the line O.ColorMap[4]:=10; the object will show yellow, where yellow should be. Look at the Demo.
  43.     Here is a list of all methods of the object DisplayPat.Object:
  44. PROCEDURE (o: Object) Install (Name: ARRAY OF CHAR; Msg: BOOLEAN);
  45. Install loads the pattern data from disk with the filename Name und links it to the Object. If Msg is TRUE, DisplayPat will show an error message at the System.Log, if something goes wrong with the Object. I included this, because i hate konstructors in C++ that do not tell me if something is wrong.
  46. PROCEDURE (o: Object) CopyPattern (col: INTEGER; PatNr: LONGINT; X, Y, mode: INTEGER);
  47. CopyPattern copys a pattern with the number PatNr in Color col at position (X, Y) at the screen. Be sure that the pattern will fit to the screen. If there is no real reason against it, use CopyPatternC instead of CopyPattern.
  48. PROCEDURE (o: Object) CopyPatternC (f: Display.Frame; col: INTEGER; PatNr: LONGINT; X, Y, mode: INTEGER);
  49. CopyPatternC does the same as CopyPattern, but the pattern will only be displayed in the Frame f. If the pattern does not fit to the frame, it will be clipped. Use CopyPatternC instead of CopyPattern.
  50. PROCEDURE (o: Object) ReplPattern (col: INTEGER; PatNr: LONGINT; X, Y, W, H, mode: INTEGER);
  51. ReplPattern fills the rectangle at position (X, Y) with hight H and width W with the pattern with number PatNr. Be sure, that the rectangle will fit in the screen. Use ReplPatternN or ReplPatternC, not ReplPattern.
  52. PROCEDURE (o: Object) ReplPatternC (f: Frame; col: INTEGER; PatNr: LONGINT; X, Y, W, H, X0, Y0, mode: INTEGER);
  53. The same like ReplPattern, but the rectangle will be cliped to the Frame f. X0 and Y0 gives an offset, where to begin in the pattern. Use ReplPatternN instead of ReplPatternC.
  54. PROCEDURE (o: Object) ReplPatternN (f: Frame; col: INTEGER; PatNr: LONGINT; X, Y, W, H, X0, Y0, mode: INTEGER);
  55. ReplPatternN does the same like ReplPatternC, but without using Display.ReplPatternC. There are problems with Display.ReplPatternC on some implementations, so ReplPatternN is the better way. It could be a bit slow on some systems (especial by Windows), but it should run on every system with patterns of any size.
  56. PROCEDURE (o: Object) GetPatternSize (PatNr: LONGINT; VAR w, h: INTEGER);
  57. GetPatternSize gives the size of the pattern PatNr in w and h back.
  58. PROCEDURE (o: Object) GetPattern (PatNr: INTEGER): LONGINT;
  59. With GetPattern You will get the Display.Pattern of the pattern PatNr. This will run only if the pattern has only one color and if the width of the pattern is <= 32.
  60. There are two porcedures in DisplayPat, that should help displaying text in non-text-frames. First you have to open a Font with Fonts.This(FontName). Then create a Texts.Writer, let`s call it W. Write to W with the normal procedure you know, for example Texts.WriteSting(W, "The Text !"). If You throw the buffer of W (W.buf) to PlotText, the Text will appear at the Screen.
  61. PROCEDURE PlotText (f: Display.Frame; col: INTEGER; Font: Fonts.Font; Buffer: Texts.Buffer; XPos, YPos, mode: INTEGER);
  62. PlotText prints the text in the Buffer with using Font, Color col and mode at position XPos, YPos to the Frame f. XPos means the base line of the font. PlotText stops, if it finds the end of the text or a linefeed. After PlotText the Buffer is empty.
  63. PROCEDURE TextLength (Font: Fonts.Font; Buffer: Texts.Buffer): INTEGER;
  64. TextLength tells You the length of the text in Buffer using Font in pixel.
  65. In this ditribution is a little Demo ( PatDemo.Mod ). Look at it and You will see how to use it.
  66. If You write a program using DisplayPat, You have to put DisplayPat.Mod in your distribution. Think of it!
  67. Bugs:
  68. I don`t know one
  69. History:
  70. V0.5    (21.10.1994)    first test release
  71. V0.6    (04.11.1994)    new procedure ReplPatternN (replaces ReplPattern and ReplPatternC)
  72.         does not import EditPat anymore
  73.         new procedure PlotText and TextLength
  74. V0.7    (21.10.1994)    mode Display.replace work fine with multicolor patterns now
  75. To Do:
  76. DisplayPat Textelements
  77. Any great idea You let me know
  78. Do You miss a procedure in this module that could be helpful or is there a problem with DisplayPat ? Tell it to me !!
  79. Ralf Degner                                                                    E-Mail: degner@pallas.amp.uni-hannover.de
  80.